$(function() {
	
	$( "#project" ).autocomplete({
		minLength: 3,
		source:function( request, response ) {
			$.ajax({  
		    type: "GET",  
		    url: "/Faltante-portlet/Autocompleteproducto",  
		    data: "prueba="+"pruebas",  
		    success: function(result){ 
		    	alert(result);
		    	$("select#almacenes").html(result);
		    }                
		  }); } ,
        dataType: 'json',
		focus: function( event, ui ) {
			$( "#project" ).val( ui.item.label );
			return false;
		},
		select: function( event, ui ) {
			$( "#project" ).val( ui.item.label );
			$( "#project-id" ).val( ui.item.value );


			return false;
		}
	})
	.data( "ui-autocomplete" )._renderItem = function( ul, item ) {
		return $( "<li>" )
			.append( "<a>" + item.label + "<br>" + item.desc + "</a>" )
			.appendTo( ul );
	};
});
